@include('admin.head')
<div class="container">
	<div class="row">
		@include('admin.side')
		<div class="col-md-10" id="content-wrapper">
			<div id="myTabContent" class="tab-content">
			 	<div class="tab-pane fade active in" id="home">
					<div class="row">
						<div class="col-xs-12">
							<div class=" clearfix">
								<div class="clearfix">
									<h2 class="pull-left">产品添加</h2>
								</div>
								<div class="panel panel-default" id="base">
									<div class="panel-body">
										<div class="form-horizontal">
										  <fieldset>


										    <div class="form-group">
										      <label class="col-xs-4 control-label no_padding_right">产品名称:</label>
										      <div class="col-xs-4">
										        <input class="form-control input_size" name="name"  placeholder="" type="text">
										      </div>
										    </div>

										    <div class="form-group">
										      <label class="col-xs-4  control-label no_padding_right">产品价格:</label>
										      <div class="col-xs-4">
										        <input class="form-control input_size" name="price"  placeholder="" type="text">
										      </div>
										    </div>


										    <div class="form-group">
										      <label class="col-xs-4  control-label no_padding_right">产品图片:</label>
										      <div class="col-xs-4">
										        <input type="file" name="imgFile" class="uploadImage">
										        <input type="hidden" name="image_name" class="hiddenName">
										        <span class="fileName"></span>
										      </div>
										    </div>

									        <div class="form-group">
							    	      		<label for="select" class="col-xs-4 control-label no_padding_right">产品详情介绍:</label>
							    	      		<div class="col-xs-6">
													<div id="container" name="content" style="height:500px;"></div>
								    	    	</div>
							    	    	</div>

										    <div class="form-group">
										      <div class="col-xs-12 text-center">
										      	<input type="hidden" name="did">
										        <button type="button" id="pro_sub" class="btn btn-primary ">提交</button>
										      </div>
										    </div>

										  </fieldset>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
			  	</div>
			</div>
		</div>
	</div>
</div>
@include("admin.footer")
@include("admin.common")
</body>




<script type="text/javascript">
var ue = UE.getEditor('container');
var url = "<%url('admin')%>/";

$(".uploadImage").AjaxFileUpload({
	path : url + "upload",
	onComplete : function(filename){
			$(this).siblings(".hiddenName").val(filename.filename);
			$(this).siblings(".fileName").html(filename.filename);
		}
	});


$("#pro_sub").click(function(){
	var name = $("input[name = 'name']").val().trim();
	var price = $("input[name = 'price']").val().trim();
	var image_name = $("input[name = 'image_name']").val().trim();
	var content = encodeURIComponent(ue.getContent());

	if(name =='' || price =='' || image_name == '' || content =='' )
		{
			warning("不能为空！");
			return false;
		}

	$.post(url+"product/save_product",{
		name : name,
		price : price,
		image_name : image_name,
		content : content
	},function(data){
		if(data.success){
			success("","提交成功");
			setTimeout(function(){
				window.location.href="../product";
			},1000)
		}
	})
})

</script>

</html>var